package homework;

import java.util.Scanner;

/**
 * @classname:demo02
 * @description:
 * @author: Mr.Z
 * @date: 2020/12/8 17:25
 * @version: 0.1
 * @since:1.8
 */
public class demo02 {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.println("请输入一个字符串");
        String str = input.next();
        boolean result = huiwen(str);
        System.out.println(result);
    }

    private static boolean huiwen(String str) {
        StringBuilder newstr = new StringBuilder(str);
        String s = newstr.reverse().toString();
        for (int i = 0; i < str.length(); i++) {
            if (str.charAt(i) != s.charAt(i)) {
                return false;
            }
        }
        return true;
    }
}
